#ifndef PopupItem_First
#define PopupItem_First
#ifdef __GNUG__
#pragma interface
#endif

#include "Buttons.h"

class Menu;

//---- MenuButton --------------------------------------------------------------

class MenuButton: public StateButton {
public:
	MetaDef(MenuButton);
	MenuButton(int id, Menu *m= 0, VObject *label= 0);
	~MenuButton();
	OStream& PrintOn(OStream&);
	IStream& ReadFrom(IStream&);
	void CollectParts(Collection*);
	Menu *MyMenu();
	void SetCollection(SeqCollection *col, bool freeold= TRUE);

protected:
	Menu *menu;
};

//---- PopupButton -------------------------------------------------------------

class PopupButton: public MenuButton {
public:
	MetaDef(PopupButton);
	PopupButton(int id, int dfltid, Menu *m= 0);
	void SetContainer(VObject *v);
	Metric GetMinSize();
	void DoTrackMouse(TrackPhase atp, Point np);
	void Draw(Rectangle r);
	Command *DispatchEvents(Point lp, Token &t, Clipper *vf);
	void Control(int id, int part, void *v);
};

//---- PullDownButton ----------------------------------------------------------

class PullDownButton: public MenuButton {
public:
	MetaDef(PullDownButton);
	PullDownButton(Menu *m= 0, VObject *label= 0);
	PullDownButton(int id, Menu*, VObject *label= 0);
	void DoTrackMouse(TrackPhase atp, Point p);
	void DrawHighlight(Rectangle r);
};

//---- MenuItem ----------------------------------------------------------------

class MenuItem : public MenuButton {
	short lastxpos, enterxpos;
public:
	MetaDef(MenuItem);
	MenuItem(int id= cIdNone, VObject *v= 0, Menu *nm= 0);
	void DoTrackMouse(TrackPhase, Point);
	void DrawInner(Rectangle, bool);
	void SetOrigin(Point at);
	Metric GetMinSize();
};

#endif
